package com.meusconcursos.dataupdate.tables;

import android.content.ContentValues;
import android.util.Log;

import com.meusconcursos.MeusConcursosActivity;
import com.meusconcursos.dataupdate.Record;
import com.meusconcursos.dataupdate.Table;

public class TableFormacao extends Table {

	@Override
	public String getTableName() {
		return "formacao";
	}

	@Override
	public String getScriptTableCreate() {
		return getHeaderScriptTableCreate()
				+ "([_id] INTEGER NOT NULL PRIMARY KEY, "
				+ "[id_cargo] INTEGER NOT NULL, " 
				+ "[nome] TEXT NOT NULL, "
				+ "[requisitos] TEXT NOT NULL,"
				+ "[atribuicoes] TEXT NOT NULL,"
				+ "[remuneracao] REAL NOT NULL,"
				+ "[jornada_diaria] INTEGER NOT NULL,"
				+ "[carga_horaria] INTEGER NOT NULL)";
	}

	@Override
	public Record newRecordInstance(String[] values) {
		ContentValues cv = null;

		cv = new ContentValues();
		int indiceValue = 0;
		
		cv.put("_id", new Integer(values[indiceValue++]));
		cv.put("id_cargo", new Integer(values[indiceValue++]));
		cv.put("nome", values[indiceValue++]);
		cv.put("requisitos", values[indiceValue++]);
		cv.put("atribuicoes", values[indiceValue++]);
		cv.put("remuneracao", new Float(values[indiceValue++]));
		cv.put("jornada_diaria", new Integer(values[indiceValue++]));
		cv.put("carga_horaria", new Integer(values[indiceValue++]));
		
		Log.i(MeusConcursosActivity.DEBUG_TAG, "Criando Registro FORMACAO: " + cv.toString());		
		
		return new Record(cv);

	}

}
